Socket
Socket
Sign inDemoInstall

lodash.find

Package Overview
Dependencies
0
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.find


Version published
Weekly downloads
1.4M
increased by2.39%
Maintainers
3
Install size
68.3 kB
Created
Weekly downloads
 

Package description

What is lodash.find?

The lodash.find npm package is a method from the Lodash library, which is a popular JavaScript utility library for manipulating and examining arrays, objects, and other data structures. The lodash.find function is used to search through an array or an object and return the first element that matches a specified condition.

What are lodash.find's main functionalities?

Find in Array

This code sample demonstrates how to use lodash.find to search through an array of objects and find the first object where the age is less than 40.

const _ = require('lodash');
const users = [
  { 'user': 'barney',  'age': 36, 'active': true },
  { 'user': 'fred',    'age': 40, 'active': false },
  { 'user': 'pebbles', 'age': 1,  'active': true }
];

const result = _.find(users, function(o) { return o.age < 40; });
console.log(result);

Find with Shorthand Syntax

This example shows how to use lodash.find with an object shorthand syntax to find an element in the array that exactly matches the specified properties.

const _ = require('lodash');
const users = [
  { 'user': 'barney',  'age': 36, 'active': true },
  { 'user': 'fred',    'age': 40, 'active': false },
  { 'user': 'pebbles', 'age': 1,  'active': true }
];

const result = _.find(users, { 'age': 1, 'active': true });
console.log(result);

Other packages similar to lodash.find

Readme

Source

lodash.find v4.6.0

The lodash method _.find exported as a Node.js module.

Installation

Using npm:

$ {sudo -H} npm i -g npm
$ npm i --save lodash.find

In Node.js:

var find = require('lodash.find');

See the documentation or package source for more details.

Keywords

FAQs

Last updated on 13 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc